// LicActivation.h: interface for the CLicActivation class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_LICACTIVATION_H__5CCA6E28_EE1A_4E5D_B242_FBB7DBD5B628__INCLUDED_)
#define AFX_LICACTIVATION_H__5CCA6E28_EE1A_4E5D_B242_FBB7DBD5B628__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

const int kUidHashLen = 5;
const int kOptBitSize = 6;
const int kOptBitSize2 = 8;
const int kMinKeyBufSize = 64;


class CLicActivation  
{
public:
	CLicActivation();
	virtual ~CLicActivation();

	int GenerateLicense(unsigned short prodId,
						const char *email, 
						const char *pwd, 
						const char* ccInfo, 
						unsigned long opts,
						char *psbuf);

	int GetLicenseInfo(	const char *email, 
						const char *pwd, 
						const char *lic, 
						const char* ccInfo, 
						unsigned short *pProdId,
						unsigned long *pOpts);
	int GenerateLicense2(unsigned short prodId,
						 const char *email, 
						 const char *pwd, 
						 const char* ccInfo, 
						 unsigned __int64 opts,
						 char *psbuf);
	int GenerateLicense3(unsigned short prodId,
						 const char *email, 
						 const char *pwd, 
						 const char* ccInfo, 
						 unsigned __int64 opts,
						 char *psbuf);

	int GetLicenseInfo2(const char *email, 
						const char *pwd, 
						const char *lic, 
						const char* ccInfo, 
						unsigned short *pProdId,
						unsigned __int64 *pOpts);

	int GetLicenseInfo3(const char *email, 
						const char *pwd, 
						const char *lic, 
						const char* ccInfo, 
						unsigned short *pProdId,
						unsigned __int64 *pOpts);

private:
	void HashUserInfo(const char* uid, const char* pwd, unsigned char buf[kUidHashLen]);
	void SplitKey(const char *key, char*sbuf);
	void MergeKey(const char *sbuf, char*key);
};

#endif // !defined(AFX_LICACTIVATION_H__5CCA6E28_EE1A_4E5D_B242_FBB7DBD5B628__INCLUDED_)
